import 'package:flutter/material.dart';
import '../models/anniversary.dart';

class CountdownWidget extends StatelessWidget {
  final Anniversary anniversary;

  const CountdownWidget({
    Key? key,
    required this.anniversary,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 150,
      margin: const EdgeInsets.only(right: 8.0),
      decoration: BoxDecoration(
        color: anniversary.color.withOpacity(0.2),
        borderRadius: BorderRadius.circular(12.0),
      ),
      child: Padding(
        padding: const EdgeInsets.all(12.0),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text(
              anniversary.daysRemaining.toString(),
              style: Theme.of(context).textTheme.headline4?.copyWith(
                color: anniversary.color,
                fontWeight: FontWeight.bold,
              ),
            ),
            const Text('天'),
            const SizedBox(height: 8),
            Text(
              anniversary.title,
              style: const TextStyle(
                fontWeight: FontWeight.bold,
              ),
              textAlign: TextAlign.center,
              maxLines: 2,
              overflow: TextOverflow.ellipsis,
            ),
          ],
        ),
      ),
    );
  }
}

